package com.hj.security.utils;

import java.util.List;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.content.Context;

public class CommonUtil {

	public static boolean isServiceRunning(Context context, String className){
		ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
		List<RunningServiceInfo> runningServiceInfos = activityManager.getRunningServices(30);
		System.out.println("className="+className);
		for (RunningServiceInfo runningServiceInfo : runningServiceInfos) {
			if(runningServiceInfo.service.getClassName().toString().equals(className)){
				return true;
			}
		}
		return false;
	}

}
